#define _GNU_SOURCE
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>


int my_siginterrupt(int sig, int flag){
    struct sigaction act;

    if (sigaction(sig, NULL, &act) == -1){
        printf("Error get sigaction signal %d %s\n", sig, strerror(errno));
        return -1;
    }

    if(flag)
       act.sa_flags = 0; 
    else
        act.sa_flags = SA_RESTART; 
    
    if (sigaction(sig, &act, NULL) == -1){
        printf("Error sigaction signal %d %s\n", sig, strerror(errno));
        return -1;
    }
    return 0;
}


int main(){
    if(my_siginterrupt(SIGFPE, 0) == -1)
        exit(EXIT_FAILURE);
    printf("Set SIGFPE\n");
    exit(EXIT_SUCCESS);
}